package analyser.node;

import model.MibNode;
import util.common.MibKeys;

import java.util.List;

public class MibObjectIdentifierAnalyser extends AbstractNodeAnalyser<MibNode> {
    public MibObjectIdentifierAnalyser(List<String> txtList) {
        super(txtList);
        this.node = new MibNode();
    }

    @Override
    protected void doAnalyse( ) {
        String str = null;
        int state = 1;
        while(state != 99){
            switch (state){
                case 1:
                    str = indexer.getNextToSpaceIgnoreLeftSpace();
                    node.name = str;
                    state = 2;
                    break;
                case 2:
                    if ((state = kit.nextMatch(MibKeys.OBJECT,3,-2)) == -2){
                    }else if ((state = kit.nextMatch(MibKeys.IDENTIFIER,3,-2)) == -2){
                    }
                    break;
                case 3:
                    state = kit.nextMatch(MibKeys.ASSIGNMENT, 4, -state);
                    break;
                case 4:
                    this.analyseLeaf();
                    state = 99;
                    break;
                default:
                    kit.ThrowAnalysisException("解析ObjectIdentifier节点异常。", state, str);
            }
        }
        return;
    }
}
